import React, { Suspense } from 'react'
import { BrowserRouter, Route, Redirect, Switch } from 'react-router-dom'

import Login from './pages/Login'
import Home from './pages/Home'
import './App.less'

function App() {
  return (
    <BrowserRouter>
      <Suspense fallback={<div className="route-loading">Loading...</div>}>
        <div className="App">
          <Switch>
            {/* 重定向到/login网址 */}
            <Route
              path="/"
              render={() => <Redirect to="/login" />}
              exact
            ></Route>
            <Route path="/login" component={Login}></Route>
            <Route path="/home" component={Home}></Route>
          </Switch>
        </div>
      </Suspense>
    </BrowserRouter>
  )
}

export default App
